const path = require('path');
function resolve(dir) {
	return path.resolve(__dirname, dir)
}
module.exports = {
	devServer: {
		port: 8080,
		open: true
	},
	publicPath: './',
	outputDir: 'dist',
	configureWebpack: {
		resolve: {
			alias: {
				'src': resolve('src'),
				'api': resolve('src/api'),
				'crm': resolve('src/crm'),
				'bus': resolve('src/bus'),
				'store': resolve('src/store'),
				'views': resolve('src/views'),
				'assets': resolve('src/assets'),
				'router': resolve('src/router'),
				'common': resolve('src/common'),
				'components': resolve('src/components'),
				'images': resolve('src/assets/images'),
			}
		}
	},
	chainWebpack(config) {
		config.module
			.rule('svg')
			.exclude.add(resolve('src/icons'))
			.end()
		config.module
			.rule('icons')
			.test(/\.svg$/)
			.include.add(resolve('src/icons'))
			.end()
			.use('svg-sprite-loader')
			.loader('svg-sprite-loader')
			.options({
				symbolId: 'icon-[name]'
			})
			.end()
	}
}